package bb.lanxing.manager;

import android.content.Context;
import android.graphics.Typeface;

public class FontsManager {
    public static final int FONT_TYPE_DIGITAL = 1;
    public static final int FONT_TYPE_LED = 2;

    private static volatile FontsManager instance;

    private Typeface digitalFont;
    private Typeface ledFont;

    private FontsManager() {
    }

    public static FontsManager getInstance() {
        if (instance == null) {
            synchronized (FontsManager.class) {
                if (instance == null) {
                    instance = new FontsManager();
                }
            }
        }
        return instance;
    }

    public void init(Context context) {
        digitalFont = Typeface.createFromAsset(context.getAssets(), "fonts/lanxing_Bold.otf");
        ledFont = Typeface.createFromAsset(context.getAssets(), "fonts/lanxing_led.ttf");
    }

    public Typeface getFont(int i) {
        if (i == FONT_TYPE_DIGITAL) {
            return digitalFont;
        } else if (i == FONT_TYPE_LED) {
            return ledFont;
        }
        return this.digitalFont;
    }
}